#include<stdio.h>
#include<unistd.h>

int main()
{
  char str[101] = {0};
  int i = 0;
  const  char *pst = "|/-|\\";
  for(;i<=100;i++)
  {
    str[i] = '#';
    if(i<50)
    {
      printf("\033[;32m[%-100s]  [%d%%] %c\r\033[0m",str,i,pst[i%5]);
    }
    else 
      printf("\033[;31m[%-100s]  [%d%%] %c\r\033[0m",str,i,pst[i%5]);
    fflush(stdout);
    usleep(200000);
  }
  printf("\n");

  return 0;
}
